//
//  YDBlockController.m
//  YDBASE
//
//  Created by wangyd on 2021/11/9.
//  Copyright © 2021 wuyezhiguhun. All rights reserved.
//

#import "YDBlockController.h"

@interface YDBlockController ()

@end

@implementation YDBlockController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    [self globalBlock];
    
    [self globalABlock];
    
    [self stackBlock];
}


//***************************************************************************

void (^jpBlock)(void) = ^{
    NSLog(@"Block =>: jpBlock =>: ");
};
/**
 * NSGlobalBlock
 */
- (void)globalBlock {
    
    NSLog(@"Block =>: GlobalBlock =>: %@", jpBlock);
    
    
}



- (void)globalABlock {
    @autoreleasepool {
        static int a = 10;

        void (^mlABlock)(void) = [^{
            NSLog(@"Block =>: mlABlock =>: a =>: %d", a);
        } copy];
        
        NSLog(@"Block =>: GlobalBlock A =>: %@", mlABlock);
    }
    
    
}



//***************************************************************************


/**
 * NSMallocBlock
 */
- (void)mallocBlock {
    
}


//***************************************************************************

int b = 10;

void (^__weak skBlock)(void) = ^{
    NSLog(@"Block =>: skBlock =>: b =>: %d", b);
};
/**
 * NSStackBlock
 */
- (void)stackBlock {
    NSLog(@"Block =>: StackBlock =>: %@", skBlock);
}









@end














